<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<script type="text/javascript">
    $(function(){
        if( $("#contentTable tr").length>1) {
            $("#contentTable").find("tr").eq(1).click();
            $("#contentTable").find("tr").eq(1).addClass("table-selected");
        }
    });
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
</script>

<div class="panel-body">
    <div class="btn-group pull-right form-group">
        <button type="button" class="btn btn-primary" onclick="loadApplyFormDiv()">添加</button>
    </div>
    <div>
        <form:form id="searchForm" modelAttribute="bloodApply"  onsubmit="return loadDivForm('applyListDiv','searchFormDict','${ctx}/blood/bloodApply/list');" method="post" class="form-inline">
            <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
            <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
        </form:form>
        <table id="contentTable" class="table table-bordered mg-t datatable">
            <thead>
                <tr>
                    <th></th>
                    <th>申请单号</th>
                    <th>血源</th>
                    <th>血型</th>
                    <th>预输血型</th>
                    <th>收费状态</th>
                    <th>申请状态</th>
                    <th>申请时间</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
            <c:forEach items="${page.list}" var="bloodApply">
                <tr onclick="bloodApplyClick('${bloodApply.id}')">
                    <td><input type="radio"  name="bloodApplyId" value="${bloodApply.id}"> </td>
                    <td> ${bloodApply.applyNum}<input type="hidden" value="${bloodApply.applyNum}" id=""/></td>
                    <td> ${fns:getDictLabel(bloodApply.bloodInuse,'BLOOD_FROM_TYPE' ,'' )}</td>
                    <td> ${fns:getDictLabel(bloodApply.patBloodGroup,'BLOOD_TYPE_DICT' ,'' )}</td>
                    <td> ${fns:getDictLabel(bloodApply.preBloodType,'BLOOD_TYPE_DICT' ,'' )}</td>
                    <td> ${fns:getDictLabel(bloodApply.chargeFlag,'NO_CHARGE' ,'' )}</td>
                    <td> ${fns:getDictLabel(bloodApply.applyStatus,'BLOOD_APPLY_STATE' ,'' )}<input type="hidden" value="${bloodApply.applyStatus}"> </td>
                    <td> <fmt:formatDate value="${bloodApply.createDate}" pattern="yyyy-MM-dd hh:mm:ss" /></td>
                    <td>
                        <a href="#" onclick="loadShowDiv('applyFormDiv','${ctx}/blood/bloodApply/form?id=${bloodApply.id}')" class="btn btn-success btn-xs">查看</a>
                        <a href="#"  class="btn btn-success btn-xs" onclick=printBloodApply('${bloodApply.applyNum}')>打印</a>
                        <c:if test="${bloodApply.applyStatus eq '0'}">
                            <a href="#"  class="applyBt btn btn-danger btn-xs" onclick="confirmExtend('确认要删除该用血申请吗？',function(){delLoad('applyListDiv','${ctx}/blood/bloodApply/delete?id=${bloodApply.id}','${ctx}/blood/bloodApply/list?patientId=${bloodApply.patientId}&visitId=${bloodApply.visitId}')})">删除</a>
                        </c:if>
                    </td>
                </tr>
            </c:forEach>

        </table>
        <div class="pagination">${page}</div>
    </div>
</div>
